﻿using HalconDotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MachineVision.Shared.Extensions
{
    //拓展方法类
    public static class HtuplesExtensions
    {
        //画矩形的扩展方法
        public static HObject GenRectangle(this HTuple[] hTuples)
        {
            if (hTuples[0].D!=0 && hTuples[1].D != 0 && hTuples[2].D != 0 && hTuples[3].D != 0)
            {
                HObject drawObj = null;
                HOperatorSet.GenRectangle1(out drawObj, hTuples[0], hTuples[1], hTuples[2], hTuples[3]);
                return drawObj;
            }

            return null;
        }

        //画椭圆的扩展方法
        public static HObject GenEllipse(this HTuple[] hTuples)
        {
            if (hTuples[0].D != 0 && hTuples[1].D != 0 && hTuples[2].D != 0 && hTuples[3].D != 0 && hTuples[4].D != 0)
            {
                HObject drawObj = null;
                HOperatorSet.GenEllipse(out drawObj, hTuples[0], hTuples[1], hTuples[2], hTuples[3], hTuples[4]);
                return drawObj;
            }

            return null;
        }

        //画圆形的扩展方法
        public static HObject GenCircle(this HTuple[] hTuples)
        {
            if (hTuples[0].D != 0 && hTuples[1].D != 0 && hTuples[2].D != 0)
            {
                HObject drawObj = null;
                HOperatorSet.GenCircle(out drawObj, hTuples[0], hTuples[1], hTuples[2]);
                return drawObj;
            }

            return null;
        }
    }
}
